package com.masterclient.app.modules.category.adapter;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.masterclient.app.R;
import com.masterclient.app.modules.category.beans.CategoryAllIndexBean;

/**
 * 作者：sean
 * 创建时间：2017/6/30 10:26
 * 功能说明：
 */

public class ClassOneAdapter extends BaseQuickAdapter<CategoryAllIndexBean.ShCategorysBean,BaseViewHolder>{


    private int clickPosition = 0;

    public ClassOneAdapter() {
        super(R.layout.item_category_1);
    }

    @Override
    protected void convert(BaseViewHolder helper, CategoryAllIndexBean.ShCategorysBean item) {
        TextView tv = helper.getView(R.id.tv_category_name);
        tv.setText(item.getSh_name());
        if(helper.getAdapterPosition()>=0&&helper.getAdapterPosition() == clickPosition){
            helper.getView(R.id.v_red_line).setVisibility(View.VISIBLE);
//            helper.getView(R.id.ll_container).setBackgroundColor(0xFFFFFFFF);
            tv.setTextColor(0xFFF23051);
        }else {
            helper.getView(R.id.v_red_line).setVisibility(View.INVISIBLE);
//            helper.getView(R.id.ll_container).setBackgroundColor(0xFFFAFAFC);
            tv.setTextColor(0xFF222222);
        }
    }


    public int getClickPosition() {
        return clickPosition;
    }

    public void setClickPosition(int clickPosition) {
        this.clickPosition = clickPosition;
        notifyDataSetChanged();
    }

}
